<%= toolbar(
  buttons: [
    {
      icon: 'user_add',
      label: Alchemy.t(:create_user),
      url: alchemy.new_admin_user_path,
      title: Alchemy.t(:create_user),
      hotkey: 'alt+n',
      dialog_options: {
        title: Alchemy.t(:create_user),
        size: "430x560"
      },
      if_permitted_to: [:create, Alchemy::User]
    }
  ]
) %>

<div id="archive_all" class="resources-table-wrapper">
  <%= resources_header %>
<% if @users.any? %>

  <table class="list" id="user_list">
    <thead>
      <tr>
        <th class="icon"></th>
        <th class="login_status"></th>
        <th class="login">
          <%= sort_link @query, :login, hide_indicator: true %>
        </th>
        <th class="name">
          <%= sort_link @query, :firstname, hide_indicator: true %>
        </th>
        <th>
          <%= sort_link @query, :lastname, hide_indicator: true %>
        </th>
        <th class="email">
          <%= sort_link @query, :email, hide_indicator: true %>
        </th>
        <th><%= Alchemy::User.human_attribute_name('language') %></th>
        <th>
          <%= sort_link @query, :last_sign_in_at, hide_indicator: true %>
        </th>
        <th class="role"><%= Alchemy::User.human_attribute_name('roles') %></th>
        <th class="tools"></th>
      </tr>
    </thead>
    <tbody>
      <%= render partial: 'alchemy/admin/users/user', collection: @users %>
    </tbody>
  </table>

  <%= paginate @users, theme: 'alchemy' %>

<% elsif params[:query] %>

  <div class="info">
    <%= render_icon('info') %>
    <%= Alchemy.t('No users found') %>
  </div>

<% end %>
</div>
